import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
  name: 'myDateLine'
})
export class MyDateLinePipe implements PipeTransform {

  transform(value: any, args?: any): any {
    const y = new Date(value).getFullYear();
    const m = new Date(value).getMonth() + 1;
    const d = new Date(value).getDate();
    const H = new Date(value).getHours();
    const M = new Date(value).getMinutes();
    const S = new Date(value).getSeconds();
    let date;
    if (value) {
      date = y + '-' + m + '-' + d + ' ' + H + ':' + M + ':' + S;
    }
    return date;
  }

}
